import * as apiService from '@/services/api';

/**
 * 游戏管理列表
 * @return {Promise<*>}
 */
const gameManagerListApi = () => apiService.post(api.GAME_MANAGER_LIST);
/**
 * 游戏管理列表--新接口
 * @return {Promise<*>}
 */
const gameSettingListApi = () => apiService.post(api.GAME_SETTING_LIST);
/**
 * 游戏管理列表--查询配置
 * @return {Promise<*>}
 */
const gameSettingDetail = params => apiService.post(api.GAME_SETTING_DETAIL, params);
/**
 * 游戏开关
 * @param id
 * @param type
 * @return {Promise<*>}
 */
const gameManagerToggleStatusApi = ({ maintenId, status }) => apiService.post(api.GAME_MANAGER_TOGGLE_STATUS,
  { maintenId, status });

/**
 * 游戏维护保存
 * @param params
 * @return {Promise<*>}
 */
const gameManagerMaintainSaveApi = params => apiService.post(api.GAME_MANAGER_MAINTAIN_SETTING_SAVE,
  params);

/**
 * 子游戏开关
 * @param id
 * @param type
 * @return {Promise<*>}
 */
const gameManagerSubGameToggleStatusApi = ({ gameId, status }) => apiService.post(api.GAME_MANAGER_SUB_TOGGLE_STATUS,
  { gameId, status });

/**
 * 子游戏详情保存
 * @param params
 * @return {Promise<*>}
 */
const gameManagerSubGameSaveApi = params => apiService.post(api.GAME_MANAGER_SUB_DETAIL_SAVE,
  params);

/**
 * 子游戏列表
 * @param gametype
 * @return {promise<*>}
 */
const gameManagerSubGameListApi = ({ channelId, gameType, subType }) => apiService.post(api.GAME_MANAGER_SUB_LIST,
  { channelId, gameType, subType });
/**
 * 获取渠道下子游戏列表
 * @param gametype
 * @return {promise<*>}
 */
const getSubGameListSelect = ({ channelId }) => apiService.post(api.GAME_SUB_LIST_SELECT,
  { channelId });

/**
 * 游戏注单详情列表
 * @param params
 * @returns {Promise<*>}
 */
const gameStatisticListApi = (params) => {
  const copyedParams = _.cloneDeep(params);
  if ([3, 4, 5, 8, 9].indexOf(params.gameId) > -1) {
    copyedParams.channelId = _.find(consts.GAME_ID, { value: params.gameId }).channelId;
    delete copyedParams.gameId;
  }
  return apiService.post(api.GAME_STATISTIC_LIST,
    copyedParams);
};
/**
 * 获取赛事注单列表
 * @param params
 * @returns {Promise<*>}
 */
const sportMatchNoteListApi = params => apiService.post(api.SPORT_MATCH_NOTE_LIST, params);
/**
 * 热门游戏配置
 * @param params
 * @returns {Promise<*>}
 */
const gameHotGameSetDetailApi = params => apiService.post(api.GAME_HOT_GAME_CONFIG_DETAIL, params);

/**
 * 热门游戏配置
 * @param params
 * @returns {Promise<*>}
 */
const gameHotGameSetSaveApi = params => apiService.post(api.GAME_HOT_GAME_CONFIG_SAVE, params);

/**
 * 推荐游戏配置
 * @param params
 * @returns {Promise<*>}
 */
const gameRecGameSetSaveApi = params => apiService.post(api.GAME_REC_GAME_CONFIG_SAVE, params);
/**
 * 热门游戏配置
 * @param params
 * @returns {Promise<*>}
 */
const gameHotRecGameSetSaveApi = params => apiService.post(api.GAME_RECHOT_GAME_CONFIG_SAVE, params);
/**
 * 游戏角标配置
 * @param params
 * @returns {Promise<*>}
 */
const gameAngleConfigApi = params => apiService.post(api.GAME_SUB_ANGLE_CONFIG, params);
/**
 * 导出游戏管理注单管理报表
 * @param params
 * @returns {Promise<*>}
 */
const exportGameManagerDetail = params => apiService.post(api.GAME_BET_LIST_EXPORT, params);

/**
 * 产品端管理列表
 * @return {Promise<*>}
 */
const productPlatformListApi = () => apiService.post(api.PRODUCT_PLATFORM_LIST);
/*
* 游戏平台维护设置
* */
const gamePlatformMaintainUpdate = params => apiService.post(api.PRODUCT_OPERATE, params);
/*
* 维护日志
* */
const gamePlatFormMainTainLog = params => apiService.post(api.GAME_PLATFORM_MAINTAIN_LOG, params);

export {
  gameManagerListApi,
  gameManagerToggleStatusApi,
  gameManagerMaintainSaveApi,
  gameManagerSubGameToggleStatusApi,
  gameStatisticListApi,
  gameManagerSubGameSaveApi,
  gameManagerSubGameListApi,
  getSubGameListSelect,
  gameHotGameSetDetailApi,
  gameHotGameSetSaveApi,
  gameRecGameSetSaveApi,
  gameHotRecGameSetSaveApi,
  gameAngleConfigApi,
  exportGameManagerDetail,
  productPlatformListApi,
  gamePlatformMaintainUpdate,
  gamePlatFormMainTainLog,
  sportMatchNoteListApi,
  gameSettingListApi,
  gameSettingDetail,
};
